# GDIR define
GDIR=../../..


# External includes
include $(GDIR)/GIMI/Makefile.gimi


# params
CC=gcc
CXX=g++
EXTRADEFS=-DLINUX_OS
MACIPATH=$(GDIR)/MaCI
UTILSPATH=$(GDIR)/utils
BUSPATH=$(MACIPATH)/bus
DRIVERPATH=$(MACIPATH)/drivers
INTERFACEPATH=$(MACIPATH)/interfaces
INCLUDES=-I$(UTILSPATH) -I$(MACIPATH) -I$(MACIPATH)/interfaces $(INCGIMI)
CFLAGS=-O0 -g3 -Wall $(INCLUDES) $(CE) $(EXTRADEFS)
CPPFLAGS=-O0 -g3 -Wall $(INCLUDES) -Weffc++ $(EXTRADEFS)
LD=g++
LDFLAGS=
LIBS=-lrt -lpthread $(LIBSGIMI)



# Sources 'base' (required external links)
SRCSC=$(CGIMI)
SRCSCPP=$(CPPGIMI)
VPATH=

# Construct final lists of CPP and C objects
OBJSC=$(SRCSC:.c=.o)
OBJSCPP=$(SRCSCPP:.cpp=.opp)

# Define COMPILE and LINK commands
COMPILEC=$(CC) $(CFLAGS) -c
COMPILECPP=$(CXX) $(CPPFLAGS) -c
LINK=$(LD) $(LDFLAGS) $(LIBS)

.PHONY: all clean real-clean

all:	RangingData_standalone

# Rules
RangingData_standalone: $(OBJSC) \
		$(UTILSPATH)/binbag.opp RangingData.cpp
	rm -f RangingData.opp
	$(COMPILECPP) -D COMPILE_RANGINGDATA_STANDALONE_MAIN RangingData.cpp -o RangingData.opp
	$(LINK) -o $@ $(OBJSC) \
		      $(UTILSPATH)/binbag.opp \
		      RangingData.opp


clean:
	rm -f *.o *.opp RangingData_standalone

real-clean:
	rm -f $(OBJSC) $(OBJSCPP)


# Compile rule for all .o (.c) file
%.o:	%.c
	$(COMPILEC) -o $@ $<

# Compile rule for all .opp (.cpp) files
%.opp:	%.cpp
	$(COMPILECPP) -o $@ $<


